<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\BlogRole
 *
 * @property int $id 主键id
 * @property string|null $type 身份
 * @method static \Illuminate\Database\Eloquent\Builder|BlogRole newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|BlogRole newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|BlogRole query()
 * @method static \Illuminate\Database\Eloquent\Builder|BlogRole whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|BlogRole whereType($value)
 * @mixin \Eloquent
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BlogUser[] $user
 * @property-read int|null $user_count
 */
class BlogRole extends Model
{
    use HasFactory;

    protected $guarded = ['id'];
    public $timestamps = false;

    public function user()
    {
        return $this->belongsToMany(BlogUser::class,'blog_role_users','tid','uid','id')
            ->withPivot('detail');
    }
}
